<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>比较三个数的大小</title>
  <style>
    body {
      font-family: Arial, sans-serif;
    }

    label {
      display: block;
      margin-bottom: 5px;
    }

    input {
      margin-bottom: 10px;
      width: 100px;
    }
  </style>
</head>

<body>
  <label for="num1">请输入第一个数：</label>
  <input type="text" id="num1" placeholder="输入数字">

  <label for="num2">请输入第二个数：</label>
  <input type="text" id="num2" placeholder="输入数字">

  <label for="num3">请输入第三个数：</label>
  <input type="text" id="num3" placeholder="输入数字">

  <button onclick="compareAndSort()">比较并排序</button>

  <div id="result"></div>

  <script>
    function compareAndSort() {
      const num1 = parseFloat(document.getElementById('num1').value);
      const num2 = parseFloat(document.getElementById('num2').value);
      const num3 = parseFloat(document.getElementById('num3').value);

      const numbers = [num1, num2, num3];
      numbers.sort((a, b) => b - a);

      const resultDiv = document.getElementById('result');
      resultDiv.innerHTML = `从大到小排序为：${numbers.join(', ')}`;
    }
  </script>
</body>

</html>